package cn.zkrt.iotms.config;

import cn.zkrt.iotms.interceptor.FeignTokenRequestInterceptor;
import feign.RequestInterceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignTokenSupportConfig {
    public static final String SPECIAL_AUTHORIZATION = "Basic 0FA7WB2KP3R317519OBPM05";

    public FeignTokenSupportConfig() {
    }

    @Bean
    public RequestInterceptor requestInterceptor() {
        return new FeignTokenRequestInterceptor();
    }

/*
    @Bean
    public RequestInterceptor headerInterceptor() {
        String token = "Basic 0FA7WB2KP3R317519OBPM05";
        return StringUtils.isBlank(token) ? (requestTemplate) -> {
            requestTemplate.header("Authorization", new String[]{SPECIAL_AUTHORIZATION});
        } : (requestTemplate) -> {
            requestTemplate.header("Authorization", new String[]{token});
        };
    }
    */
}
